﻿function getScrollTop()
{
    var scrollTop=0;
    if(document.documentElement&&document.documentElement.scrollTop)
    {
        scrollTop=document.documentElement.scrollTop;
    }
    else if(document.body)
    {
        scrollTop=document.body.scrollTop;
    }
    return scrollTop;
}
var domarr = [];
jQuery.dialog = {
  /*
  *消息框
  */
  alert: function (text,arg) {
	  closeDialog();
    var opt = $.extend({},setting_default,arg);
    var $window = $('<div class="windowcenter"></div>');
    var top = getScrollTop();
    $window.css({ "position": "absolute","border": "1px solid rgb(207, 206, 206)", "width": "267px", "display": "none", "margin": "0 auto 0 -136px", "padding": "2px",
      "top": ""+top+"px", "left": "50%", "border-radius": "0.6em", "-webkit-border-radius": "0.6em", "-moz-border-radius": "0.6em",
      "background-color": "#f1f1f1", "-webkit-box-shadow": "0 0 10px rgba(0, 0, 0, 0.5)", "-moz-box-shadow": "0 0 10px rgba(0, 0, 0, 0.5)",
      "-o-box-shadow": "0 0 10px rgba(0, 0, 0, 0.5)", "box-shadow": "0 0 10px rgba(0, 0, 0, 0.5)",
      "font": "14px/1.5 Microsoft YaHei, Helvitica, Verdana, Arial, san-serif", "z-index": "9990"
    });
    var $title = $('<div>'+opt.title+'</div>');
    $title.css({ "background-color": "#585858", "line-height": "26px", "padding": "5px 5px 5px 10px", "color": "#fff", "font-size": "16px",
      "border-radius": "0.5em 0.5em 0 0", "-webkit-border-radius": "0.5em 0.5em 0 0", "-moz-border-radius": "0.5em 0.5em 0 0"
    });
    var $close = $('<span></span>');
    $close.css({ "float": "right", "width": "26px", "height": "26px", "display": "block", "background-image": "url('data:image/png;base64," +
        "iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACTSURBVEhL7dNtCoAgD" +
        "AZgb60nsGN1tPLVCVNHmg76kQ8E1mwv+GG27cestQ4PvTZ69SFocBGpWa8+zHt/Up+IN+MhgLlUmnIE1CpBQB2COZibfpnXhHFaIZkYph0SOeeK/QJ8o7KOek84fkCWSBtfL+N" +
        "y2MPpCkPFMH6PWEhWhKncIyEk69VfiUuVhqJefds+YcwNbEwxGqGIFWYAAAAASUVORK5CYII=')"
    });
    $close.click(function () {
      if ($(".windowcenter").length > 0) {
        $(".windowcenter").slideUp(500);
		 $(".overlay").remove();
		 opt.ok();
      }
    });
    $title.append($close);
    $window.append($title);
    var $content = $('<div></div>');
    $content.css({ "overflow": "auto", "padding": "10px", "color": "#222", "text-shadow": "0 1px 0 #FFFFFF" });
    var $text = $('<div></div>');
    $text.css({ "min-height": "30px", "font-size": "14px", "line-height": "20px" });
    $text.text(text);
    $content.append($text);
    $window.append($content);
    $("body").append(overlay).append($window);
    $(".windowcenter").slideDown("slow");
    setTimeout(function(){$(".windowcenter").slideUp(300,function(){
	$(".overlay").remove();opt.ok();
	}); }, 2000);
  },alertTxt: function (text,arg) {
	  closeDialog();
	  var opt = $.extend({},setting_default,arg);
	  var top = getScrollTop();
	    var $window = $('<div class="windowcenter"></div>');
	    $window.css({ "position": "fixed","border": "1px solid rgb(207, 206, 206)", "width": "100%","height":"80px",
	      "top": ""+top+"px","font": "14px/1.5 Microsoft white, Helvitica, Verdana, Arial, san-serif","text-align":"center",
			"z-index": "10","background":"orange","line-height":"80px","color":"white"
	    });
    $window.text(text);
    //$content.append($text);
    //$window.append($text);
    $("body").append(overlay).append($window);
    setTimeout(function(){$(".windowcenter").slideUp(500,function(){
    	$(".windowcenter").remove();
   	 $(".overlay").remove();opt.ok()
   	}); }, 1000*opt.time);
  },
  alertTxt2: function (text,arg) {
	  var opt = $.extend({},setting_default,arg);
	 if ( $(".windowcenter2").size() > 0)
	 {
$(".windowcenter2").text(text);
$("#"+opt.id).css("border","1px solid red");
if ( $.inArray(opt.id,domarr) == -1)
{
	domarr.push(opt.id);
	$("#"+opt.id).get(0).addEventListener("input",function(o){
        var re = o.target.value;
	   if ( "" != re){
		   //
		   $(this).css("border","0px");
			  domarr.remove(opt.id);
			  $(".windowcenter2").remove();
	   }
	});
	
	
	/*$("#"+opt.id).click(function(){
	  $(this).css("border","0px");
	  domarr.remove(opt.id);
	  $(".windowcenter2").remove();
	});*/
}
return;
	 }
	 var top = getScrollTop();
    var $window = $('<div class="windowcenter2"></div>');
    $window.css({ "position": "fixed","border": "1px solid rgb(207, 206, 206)", "width": "50%","height":"40px",
      "top": ""+top+"px","font": "14px/1.5 Microsoft white, Helvitica, Verdana, Arial, san-serif","text-align":"center",
		"z-index": "10","background":"red","line-height":"40px","color":"white","margin-left":"25%","dispaly":"none"
    });
    $window.text(text);
    //$content.append($text);
    //$window.append($text);
    $("body").append($window);
    $window.slideDown(300);
	$("#"+opt.id).css("border","1px solid red");
	if ( $.inArray(opt.id,domarr) == -1)
{
	domarr.push(opt.id);
	$("#"+opt.id).get(0).addEventListener("input",function(o){
        var re = o.target.value;
	   if ( "" != re){
		   //
		   $(this).css("border","0px");
			  domarr.remove(opt.id);
			  $(".windowcenter2").remove();
	   }
	});
	/*$("#"+opt.id).click(function(){
	  $(this).css("border","0px");
	  domarr.remove(opt.id);
	  $(".windowcenter2").remove();
	});*/
}
  },
  windowMsg: function (text,arg) {
	  closeDialog();
	  var opt = $.extend({},setting,arg);
	  var top = getScrollTop();
	  var height = ($(window).height()-opt.height)/2;
	  var width = ($(window).width()-opt.width)/2;
	    var $window = $('<div class="windowcenter"></div>');
	    $window.css({ "position": "fixed","border": "1px solid rgb(188, 185, 185)","background":"white",
	      "top": ""+height+"px","left": ""+width+"px",
			"z-index": "10"
	    });
	    var $popShow = $('<div style="width:100%;float:left;display:block;border-bottom: 1px solid #EDEDED"></div>');
	    var $title = $('<h4>'+opt.title+'</h4>');
	    $title.css({ "padding": "0", "margin": "0","text-indent":"10px", "height": "34px", "font-size": "16px", 
	      "line-height": "34px", "color": "#252E32","float":"left"
	    });
	    $popShow.append($title);
	    var $close = $('<span></span>');
	    $close.css({ "float": "right", "width": "26px", "height": "26px", "display": "block", "background-image": "url('data:image/png;base64," +
	        "iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACTSURBVEhL7dNtCoAgD" +
	        "AZgb60nsGN1tPLVCVNHmg76kQ8E1mwv+GG27cestQ4PvTZ69SFocBGpWa8+zHt/Up+IN+MhgLlUmnIE1CpBQB2COZibfpnXhHFaIZkYph0SOeeK/QJ8o7KOek84fkCWSBtfL+N" +
	        "y2MPpCkPFMH6PWEhWhKncIyEk69VfiUuVhqJefds+YcwNbEwxGqGIFWYAAAAASUVORK5CYII=')"
	    });
	    $close.click(function () {
	      if ($(".windowcenter").length > 0) {
	        $(".windowcenter").slideUp(500);
			 $(".overlay").remove();
			 opt.ok();
	      }
	    });
	    $popShow.append($close);
	    var $text = $('<div>' + text + '</div>');
	    $text.css({ "font-size": "16px", "padding": "10px 0px","float":"left","width":"100%","background-color": "#FFF" });
	    $popShow.append($text);
	    $window.append($popShow);
    $("body").append(overlay).append($window);
  },
  
 /**
  *加载框
  *
  */
  loading:function(msg){
	  closeDialog();
	  if (msg == undefined)
	  {
		  msg = "loading";
	  }
	  //msg = msg | "loading";
  // var opt = $.extend({},setting_default,arg);
var $popTips = $('<div class="windowcenter" style="display: block;"></div>');
    $popTips.css({ "position": "fixed","z-index": "9999", "left": "50%", "top": "40%", "width": "60px", "overflow": "hidden",
      "margin-left": "-30px",    "background-color":"#F8F5F5", "font-size": "14px", "text-align": "center", "border-radius": "5px"
    });//"background-color": "#FBFBFB",

   var $img = $('<img src="'+
   '/0CAcEgUDAgFA8BQIAwExKh0eEAkrlcA9oo4TKcKwharHScIiu9wwTBn3QnGQg1owBNld+O72N/zZnVzRApteFsODwoQABAKDw5bZQxpQ2JkCRESahIRh1gEVIGVamlmXgBWWxETdEMTnlsIAAJmm65DEmZGYw64UZFbR2MPv0QPY0hjpMYKY0ljjMZCEGNK09MG0diN1gXL3M5bTcTcyFtOvdz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VHQYbYRIRhWgEQwd7AB52AGt7YAAIchETrUITpGgIAAJ7ErdDEnsCA3IOwUSWaAOcaA/JQ0amBXKa0QpyBQZyENFCEHIG39HcaN7f4WhM1uTZaE1y0N/TacZoyN/LXU+/0cNyoMxCUytYLjm8AKSS46rVKzmxADhjlCACMFGkBiU4NUQRxS4OHijwNqnSJS6ZovzRyJAQo0NhGrgs5bIPmwWLCLHsQsfhxBWTe9QkOzCwC8sv5Ho127akyRM7QQAAOwAAAAAAAAAAAA=="  style="display: block;" />');
$img.css({ "width": "35px","height":"35px","marginLeft":"12px","margin-top":"5px"});
$popTips.append($img);
$div=$("<div style='margin-top:10px;color:teal'>"+msg+"</div>");
$popTips.append($div);
$("body").append(overlay).append($popTips);
  },
ploading:function(msg){
	  if (msg == undefined)
	  {
		  msg = "loading";
	  }
	  //msg = msg | "loading";
  // var opt = $.extend({},setting_default,arg);
var $popTips = $('<div class="windowcenter" style="display: block;"></div>');
    $popTips.css({ "position": "fixed","z-index": "9999", "left": "50%", "top": "40%", "width": "134px", "overflow": "hidden",
      "margin-left": "-122px",  "font-size": "14px", "background-color":"#F8F5F5", "text-align": "center", "border-radius": "5px"
    });//"background-color": "#FBFBFB",

   var $img = $('<img src="'+
   'Pbi+Ob66MrlA+scBAQwcKC/c/8SIlzI71/BduysRcTGUF49i/cw5tO4jytjv3keH0oUCJHkSI8KG1Y8qLIlypMm312ASZCiNA0X8eHMqPNCTo07iyUAACH5BAkKAAAALAAAAACAAA8AAAP/CLQL/qw9F8mk8ap8hffaB3ZiWJKfmaJgJWHV5FqQK9uPuDr6yPeTniAIzBV/utktVmPCOE8GUTc9Ia0AYXWXPXaTuOhr4yRDzVIjVY3VsrnuK7ynbJ7rYlp+6/u2vXF+c2tyHnhoY4eKYYJ9gY+AkYSNAotllneMkJObf5ySIphpe3ajiHqUfENvjqCDniIFsrMFE7Sztre1D7q7Dr0TA8LDA8HEwsbHycTLw83ID8fCwLy6ubfXtNm40dLPxd3K4czjzuXQDtID1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9W6iwIbd6CdP9OmjtGzcNFsVhDHfxDELGjxw1Xpg4kheABAAh+QQJCgAAACwAAAAAgAAPAAAD/wi0C/6sPRfJpPGqfKv2HTeBowiZjqCqG9malYS5sXXScYnvcP6swJqux2MMjTeiEjlbyl5MAHAlTEarzasv+8RCu9uvjTuWTgXedFhdBLfLbGf5jF7b30e3PA+/739ncVp4VnqDf2R8ioBTgoaPfYSJhZGIYhN0BZqbBROcm56fnQ+iow6loZ+pnKugpKKtmrGmAAO2twOor6q7rL2up7C/ssO0usG8yL7KwLW4tscA0dPCzMTWxtXS2tTJ297P0Nzj3t3L3+fmzerX6M3hueTp8uv07ezZ5fa08Piz/8UAYhPo7t6+CfDcafDGbOG5hhcYKoz4cGIrh80cPAOQAAAh+QQJCgAAACwAAAAAgAAPAAAD5wi0C/6sPRfJpPGqfKv2HTeBowiZGLORq1lJqfuW7Gud9YzLud3zQNVOGCO2jDZaEHZk+nRFJ7R5i1apSuQ0OZT+nleuNetdhrfob1kLXrvPariZLGfPuz66Hr8f8/9+gVh4YoOChYhpd4eKdgwFkJEFE5KRlJWTD5iZDpuXlZ+SoZaamKOQp5wAm56loK6isKSdprKotqqttK+7sb2zq6y8wcO6xL7HwMbLtb+3zrnNycKp1bjW0NjT0cXSzMLK3uLd5Mjf5uPo5eDa5+Hrz9vt6e/qosO/GvjJ+sj5F/sC+uMHcCCoBAA7AAAAAAAAAAAA"  style="display: block;" />');
$img.css({ "width": "128px","height":"15px","margin-left":"3px","margini-top":"5px"});
$popTips.append($img);
$div=$("<div style='margin-top:10px;color:teal'>"+msg+"</div>");
$popTips.append($div);
$("body").append(overlay).append($popTips);
  },
txtloading:function(msg){
	  closeDialog();
	  if (msg == undefined)
	  {
		  msg = "loading";
	  }
	  //msg = msg | "loading";
  // var opt = $.extend({},setting_default,arg);
var $popTips = $('<div class="windowcenter" style="display: block;">'+msg+'</div>');
    $popTips.css({ "position": "fixed","z-index": "9999", "left": "50%", "top": "40%","height":"40px", "padding":"5px 10px","overflow": "hidden",
      "margin-left": "-30px",    "background-color":"#000000", "font-size": "1.0em","color":"white","line-height":"40px", "text-align": "center", "border-radius": "5px"
    });//"background-color": "#FBFBFB",

$("body").append(overlay).append($popTips);
  },
  /*
   *对话框
   */
  message: function (text,arg) {
	  closeDialog();
	 var opt = $.extend({},setting_default,arg);
    var $popTips = $('<div class="windowcenter" style="display: block;"></div>');
    $popTips.css({ "position": "fixed","border": "1px solid rgb(207, 206, 206)","z-index": "9999", "left": "50%", "top": "30%", "width": "255px", "overflow": "hidden",
      "margin-left": "-122px", "background-color": "#FBFBFB", "font-size": "14px", "text-align": "center", "border-radius": "5px"
    });
    $popTips.append('<div></div>');

    var $popShow = $('<div></div>');
    var $title = $('<h4>'+opt.title+'</h4>');
    $title.css({ "padding": "0", "margin": "0","font":"12px/1.5 tahoma,arial", "height": "34", "font-size": "14px", "border-bottom": "1px solid rgb(225, 218, 218)",
      "line-height": "34px", "color": "#b9d7f6","background":"#4592f0","text-align":"left","text-indent":"10px"
    });
    $popShow.append($title);
    var txt = '<div>';
    if (opt.type != "no" && typeof(opt.type) != "undefined"){
    	//
    	txt+="<img src='/frame/images/"+opt.type+".png' style='margin-right:10px ;vertical-align: bottom;' width='30' height='30'/>";
    }
    $text=$(txt+text+'</div>');
    $text.css({ "font-size": "14px", "padding": "20px 0px", "background-color": "#FFF","line-height": "30px" });
    $popShow.append($text);
    var $popBtns = $('<div></div>');
    $popBtns.css("text-align", "center");
    var a_css = { "display": "block","height": "40px","color":"#536083", "line-height": "40px", "border-top": "1px solid #E2E1E0",
      "text-decoration": "none"
    };
    //取消事件或OK事件
   // var cancelEvent = function () {//#5B5B5B
    //  closeDialog();
   // }
    var $ok = $('<a href="javascript:void(0);">'+opt.ytxt+'</a>');
    $ok.css(a_css);
	$ok.hover(function(){$(this).css({"color":"#fff","background":"#4592f0"})},function(){$(this).css({"color":"#536083","background":"none"})});
    //有取消按钮并且有确定的回调函数，设置确定后调用回调函数并追加取消按钮同时设定取消事件
    if (opt.cancel) {
      $ok.click(function(){
    	  if (opt.id != undefined){
 			 opt.yes();
	    }else{
	    	
	    	 closeDialog();
	 		 opt.yes();
	    }
	  });


      //设置取消按钮和取消事件
      $ok.css({ "width": "127px", "float": "right" });
      var $cancel = $('<a style="clear:both;width:127px; float:left; border-right:1px solid #E2E1E0" href="javascript:void(0);">'+opt.ntxt+'</a>');
      $cancel.css(a_css);
      $cancel.click(function(){
		closeDialog();
		opt.no();

	  });
$cancel.hover(function(){$(this).css({"color":"#fff","background":"#4592f0"})},function(){$(this).css({"color":"#536083","background":"none"})});
//$cancel.hover(function(){$(this).css("color","#6B5B5B")},function(){$(this).css("color","#536083")});

$popBtns.append($cancel);
    } else {
      $ok.click(function(){
	   
    	  if (opt.id != undefined){
    			 opt.ok();
	    }else{
	    	 closeDialog();
	 		 opt.ok();
	    }
	  });
    }
    $popBtns.append($ok);
    $popShow.append($popBtns);
    $popTips.append($popShow);
   
    $('body').append(overlay).append($popTips);
  }
}
function closeDialog(){
	
      $(".windowcenter").remove();
      $(".overlay").fadeOut(100,function(){
    	  $(this).remove();
      });
	  //$(".overlay").hide(300,function(){
	  // $(this).remove();
	 // });
	/* $(".overlay").fadeOut(100,function(){
		 $(this).remove();
		 $(".windowcenter").remove();
	 });*/
 // $("#windowcenter").remove();
  
}
var setting_default = {title:"",ok:function(){closeDialog();},yes:function(){},no:function(){

},time:2,cancel:false,title:"温馨提示",ytxt:"确 定",ntxt:"取 消",oktxt:"确定",type:"no"}
var overlay = "<div class='overlay' style='position:fixed;z-index:9999;left:0px;top:0px;background-color: #ccc;opacity: 0.5;filter: alpha(opacity = 50);width:"+(parseInt(jQuery(this).width()))+"px;height:"+parseInt(jQuery(this).height())+"px'></div>";
window.onresize = function(){
	
	overlay = "<div class='overlay' style='position:fixed;z-index:9999;left:0px;top:0px;background-color: #ccc;opacity: 0.5;filter: alpha(opacity = 50);width:"+(parseInt(jQuery(this).width()))+"px;height:"+parseInt(jQuery(this).height())+"px'></div>";
}

window.alert=function(msg,arg){
  arg = arg == undefined?{}:arg;
  arg = $.extend({type:"info"},arg);
  $.dialog.message(msg,arg);
}
function Wwindow(msg,arg){
	  arg = arg == undefined?{}:arg;
	  arg = $.extend({},arg);
	  $.dialog.windowMsg(msg,arg);
	}
//确定对话框
function Wconfirm(msg,arg){
  arg = arg == undefined?{cancel:true}:arg;
  arg = $.extend({cancel:true,type:"confirm"},arg);
  $.dialog.message(msg,arg);
}
//加载进度条
function Wloading(msg){
  $.dialog.loading(msg);
}
//第二种进度条
function Wploading(msg){
   $.dialog.ploading(msg);
}
function Wloading3(msg){
   $.dialog.txtloading(msg);
}
Array.prototype.remove=function(dx) 
{ 
    if(isNaN(dx)||dx>this.length){return false;} 
    for(var i=0,n=0;i<this.length;i++) 
    { 
        if(this[i]!=this[dx]) 
        { 
            this[n++]=this[i] 
        } 
    } 
    this.length-=1 
}
//tip框
function Wtip(msg,arg){
	arg = arg == undefined?{}:arg;
   $.dialog.alert(msg,arg);
}
function Wtip2(msg,arg){
	arg = arg == undefined?{}:arg;
   $.dialog.alertTxt(msg,arg);
}
function alert2(msg,arg){
	arg = arg == undefined?{}:{id:arg};
   $.dialog.alertTxt2(msg,arg);
}